xend: Fix xm block/network-attach command for inactive managed domain
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 6 Jul 2007 13:41:05 +0000 (14:41 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 6 Jul 2007 13:41:05 +0000 (14:41 +0100)
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
tools/python/xen/xend/XendDomainInfo.py

index 2f9eb592f51407080ac78d60c590da8ab8d9a0eb..a142d07301415cc7d23e22dbd6354d2e1fbcbe5a 100644 (file)
@@ -502,9 +502,18 @@ class XendDomainInfo:
         dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
         dev_config_dict = self.info['devices'][dev_uuid][1]
         log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
-        dev_config_dict['devid'] = devid = \
-             self._createDevice(dev_type, dev_config_dict)
-        self._waitForDevice(dev_type, devid)
+
+        if self.domid is not None:
+            try:
+                dev_config_dict['devid'] = devid = \
+                    self._createDevice(dev_type, dev_config_dict)
+                self._waitForDevice(dev_type, devid)
+            except VmError, ex:
+                raise ex
+        else:
+            devid = None
+
+        xen.xend.XendDomain.instance().managed_config_save(self)
         return self.getDeviceController(dev_type).sxpr(devid)
 
     def device_configure(self, dev_sxp, devid = None):